# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=newt
pkgver=0.52.24
pkgrel=1
pkgdesc="Redhat's Newt windowing toolkit development files"
options="!check" # No testsuite
url="https://pagure.io/newt/"
arch="all"
license="LGPL-2.0-only"
makedepends="slang-dev popt-dev python3-dev ncurses-dev"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang py3-$pkgname:py3"
source="https://releases.pagure.org/newt/newt-$pkgver.tar.gz"

prepare() {
	default_prepare

	sed -i -e 's:-lslang:-lslang -lncurses:g' \
		-e 's:instroot:DESTDIR:g' Makefile.in
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--without-tcl \
		--disable-nls
	make RPM_OPT_FLAGS="$CFLAGS"
}

package() {
	make DESTDIR="$pkgdir" prefix="/usr" RPM_OPT_FLAGS="ERROR" install
	rm -f "$pkgdir"/usr/lib/*.a
}

py3() {
	pkgdesc="Python3 bindings for Newt windowing toolkit"
	depends="$pkgname=$pkgver-r$pkgrel python3"
	amove '/usr/lib/python*'
}

sha512sums="
2001f45fb1cdb48cbc51feb8b6e555a2e50b65d897db2dbc1b1711c04efb51834801bef921c89879ddb43de221a243ed240c4a3355eebafa78f50f24432acdcd  newt-0.52.24.tar.gz
"
